#ifndef SIGNINWIDGET_H
#define SIGNINWIDGET_H

#include <QWidget>
#include <QtNetwork/QNetworkRequest>
#include <QtNetwork/QNetworkAccessManager>
#include <QJsonObject>

#include "server.h"

namespace Ui {
class SignInWidget;
}

class SignInWidget : public QWidget
{
    Q_OBJECT

public:
    explicit SignInWidget(QWidget *parent = nullptr);
    ~SignInWidget();

signals:
    void signal_signInSuccess(QJsonObject);

private slots:
    void on_pushButton_signIn_clicked();
    void slot_finishRequest(QNetworkReply *);

    void on_pushButton_signUp_clicked();

private:
    Ui::SignInWidget *ui;
    QNetworkRequest m_request;
    QNetworkAccessManager m_manager;
    const QString m_signInUrl = "http://" + Server::serverAddr() + ":" + Server::port() + "/users";
};

#endif // SIGNINWIDGET_H
